import { getFormatterPrice } from '@const/filter'
// 支付单列表
// tab切换
export const indexTabsArr = [
  { lab: '待付款', val: 1, badge: { value: null } },
  { lab: '部分付款', val: 4, badge: { value: null } },
  { lab: '已付款', val: 2, badge: { value: null } },
  { lab: '已完结', val: 5, badge: { value: null } },
  { lab: '已撤销', val: 3, badge: { value: null } },
  { lab: '全部', val: '', badge: { value: null } }
]
// 搜索字段
export const indexSearchData = [
  {
    key: 'distributorName',
    title: '收款方名称',
    type: 'input',
    attr: {
      placeholder: '请输入',
      maxlength: '99'
    }
  },
  {
    key: 'startTime',
    title: '创建时间',
    type: 'time',
    fieldname: ['beginDate', 'endDate'],
    attr: {
      style: 'width:270px !important;',
      class: 'daterange',
      type: 'daterange',
      'start-placeholder': '开始时间',
      'end-placeholder': '结束时间',
      'default-time': ['00:00:00', '23:59:59']
    }
  }
]

// 列表表头
export const columsData = [
  { type: 'index', label: '序号', width: 60 },
  { prop: 'tradeOrderCode', label: '支付单号', 'min-width': 150, 'show-overflow-tooltip': true },
  { prop: 'spdPayOrderCode', label: '关联支付单号', 'min-width': 150, 'show-overflow-tooltip': true },
  { prop: 'distributorName', label: '收款方名称', 'min-width': 150, 'show-overflow-tooltip': true },
  { prop: 'invoiceAmount', label: '总金额（元）', 'min-width': 150, formatter: row => getFormatterPrice(row.invoiceAmount) },
  { prop: 'invoiceCount', label: '关联发票数', 'min-width': 150 },
  { prop: 'createdAt', label: '创建时间', 'min-width': 150 },
  { prop: 'tradeOrderStatusName', label: '状态', 'min-width': 100 },
  { prop: 'action', label: '操作', width: 140, fixed: 'right' }
]

// 详情页基础数据
export const paymentbaseList = [
  [
    { prop: 'tradeOrderCode', span: 6, placeholder: '请输入', label: '支付单号：', type: 'input' },
    { prop: 'invoiceAmount', span: 6, placeholder: '请输入', label: '发票金额', type: 'input' },
    { prop: 'invoiceCount', span: 6, placeholder: '请输入', label: '发票数量', type: 'input' },
    { prop: 'prodTotalAmount', span: 6, placeholder: '请输入', label: '产品金额', type: 'input' }
  ],
  [
    { prop: 'prodVarietyCount', span: 6, placeholder: '请输入', label: '品种数', type: 'input' },
    { prop: 'prodTotalCount', span: 6, placeholder: '请输入', label: '产品总数', type: 'input' },
    { prop: 'distributorName', span: 6, placeholder: '请输入', label: '配送商', type: 'input' },
    { prop: 'createdAt', span: 6, placeholder: '请输入', label: '创建时间', type: 'date' }
  ]
]

// 付款记录表头
export const paymentrecordColums = [
  { prop: 'tradeAmount', label: '付款金额(元)', 'min-width': 300, formatter: row => getFormatterPrice(row.tradeAmount) },
  { prop: 'surplusAmount', label: '剩余付款金额(元)', 'min-width': 300, formatter: row => getFormatterPrice(row.surplusAmount) },
  { prop: 'tradeTime', label: '付款时间', 'min-width': 200 },
  { prop: 'tradeBy', label: '付款人', 'min-width': 200 },
  { prop: 'remarks', label: '备注', 'min-width': 300 }
]
// 详情页-基本信息表头
export const nissinReadColunmns = [
  [
    { key: 'tradeOrderCode', label: '支付单号:' },
    { key: 'distributorName', label: '收款方名称:' },
    { key: 'invoiceAmount', label: '金额合计（元）:' }
  ],
  [
    { key: 'invoiceCount', label: '关联发票数:' },
    { key: 'saleBankInfo', label: '收款方开户信息:' },
    { key: 'createdAt', label: '创建时间:' }
  ]
]
// 详情 - 付款记录
export const collectionColumns = [
  {
    prop: 'tradeAmount',
    label: '付款金额（元）',
    'min-width': 150,
    formatter: row => {
      if (row.tradeAmount) {
        return getFormatterPrice(row.tradeAmount)
      }
    }
  },
  {
    prop: 'surplusAmount',
    label: '剩余付款金额（元）',
    'min-width': 150,
    formatter: row => {
      if (row.surplusAmount) {
        return getFormatterPrice(row.surplusAmount)
      } else {
        return 0
      }
    }
  },
  { prop: 'tradeTime', label: '付款时间', 'min-width': 150 },
  { prop: 'tradeBy', label: '付款人', 'min-width': 150 },
  { prop: 'remarks', label: '备注', 'min-width': 150 }
]
// 详情/付款 - 发票
export const invoiceColumns = [
  // { type: 'selection', label: '发票影像', 'min-width': 150 },
  { prop: 'invoicePng', label: '发票影像', width: 100 },
  { prop: 'invoiceList', label: '发票清单', width: 100 },
  { prop: 'invoiceNo', label: '发票号码', 'min-width': 150, 'show-overflow-tooltip': true },
  { prop: 'invoiceKindName', label: '发票类型', 'min-width': 150, 'show-overflow-tooltip': true },
  { prop: 'invoiceCode', label: '发票代码', 'min-width': 150, 'show-overflow-tooltip': true },
  { prop: 'invoiceDate', label: '开票日期', 'min-width': 150, 'show-overflow-tooltip': true },
  {
    prop: 'totalPriceTax',
    label: '价税合计',
    'min-width': 150,
    'show-overflow-tooltip': true,
    formatter: row => {
      if (row.totalPriceTax) {
        return getFormatterPrice(row.totalPriceTax)
      }
    }
  },
  // { prop: 'totalTax', label: '税率', 'min-width': 150, 'show-overflow-tooltip': true },
  {
    prop: 'totalTax',
    label: '税额',
    'min-width': 150,
    'show-overflow-tooltip': true
    // formatter: row => {
    //   if (row.totalTax) {
    //     return getFormatterPrice(row.totalTax)
    //   }
    // }
  },
  {
    prop: 'amountNoTax',
    label: '发票金额',
    'min-width': 150,
    'show-overflow-tooltip': true,
    formatter: row => {
      if (row.amountNoTax) {
        return getFormatterPrice(row.amountNoTax)
      }
    }
  },
  { prop: 'checkCode', label: '校验码', 'min-width': 150, 'show-overflow-tooltip': true },
  { prop: 'saleCompany', label: '销售方', 'min-width': 150, 'show-overflow-tooltip': true },
  { prop: 'saleRegistrationCode', label: '销售方纳税人识别号', 'min-width': 150, 'show-overflow-tooltip': true },
  { prop: 'buyCompany', label: '采购方', 'min-width': 150, 'show-overflow-tooltip': true },
  { prop: 'buyRegistrationCode', label: '采购方纳税人识别号', 'min-width': 150, 'show-overflow-tooltip': true },
  { prop: 'remark', label: '备注', 'min-width': 150, 'show-overflow-tooltip': true }
]
